package com.omega_r.omegarecyclerview;

import com.omega_r.libs.omegarecyclerview.viewpager.NumberUtil;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class ExampleOhosTest {
    @Test
    public void testBundleName() {
        final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
        assertEquals("com.omega_r.omegarecyclerview", actualBundleName);
    }

    @Test
    public void testAddDouble() {
        double add = NumberUtil.add(1.02, 2.02);
        assertEquals(3.04, add, 0.0);
    }

    @Test
    public void testAddString() {
        double add = NumberUtil.add("1.02", "2.02");
        assertEquals(3.04, add, 0.0);
    }

    @Test
    public void testSubDouble() {
        double sub = NumberUtil.sub(2.02, 1.02);
        assertEquals(1.00, sub, 0.0);
    }

    @Test
    public void testSubString() {
        double sub = NumberUtil.sub("2.02", "1.02");
        assertEquals(1.00, sub, 0.0);
    }

    @Test
    public void testMulDouble() {
        double mul = NumberUtil.mul(1.1, 1.1);
        assertEquals(1.21, mul, 0.0);
    }

    @Test
    public void testMulString() {
        double mul = NumberUtil.mul("1.1", "1.1");
        assertEquals(1.21, mul, 0.0);
    }

    @Test
    public void testDivDouble() {
        double div = NumberUtil.div(2.1, 2.1);
        assertEquals(1.00, div, 0.0);
    }

    @Test
    public void testDivString() {
        double div = NumberUtil.div("2.1", "2.1");
        assertEquals(1.00, div, 0.0);
    }

    @Test
    public void testRoundDouble() {
        double round = NumberUtil.round(2.16,1);
        assertEquals(2.2, round, 0.0);
    }

    @Test
    public void testRoundString() {
        double round = NumberUtil.round("2.16",1);
        assertEquals(2.2, round, 0.0);
    }
}